package com.liyingtao.biz;

import com.liyingtao.bean.Admin;
import com.liyingtao.dao.AdminMapper;
import com.liyingtao.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

public class AdminService {
    SqlSession session = SqlSessionFactoryUtil.getSqlSession();
    AdminMapper adminmapper = session.getMapper(AdminMapper.class);

    public  int addAdmin(Admin admin){

        int flag = adminmapper.addAdmin(admin);
        session.commit();
        if(session!=null){
            session.close();
        }
        return flag;
    }

    public Admin adminLogin(Admin admin){
       return adminmapper.adminLogin(admin);
    }

    public Admin checkName(String adminName){
        return adminmapper.checkName(adminName);
    }
}
